#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(mod_freetdm)

IF(NOT DEFINED WIN32)
	ADD_DEFINITIONS(-g -O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0 -g -ggdb -DPACKAGE_NAME=\"freetdm\" -DPACKAGE_TARNAME=\"freetdm\" -DPACKAGE_VERSION=\"pre-alpha\" -DPACKAGE_STRING=\"freetdm\ pre-alpha\" -DPACKAGE_BUGREPORT=\"bugs@freeswitch.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libfreetdm\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBDL=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBM=1 -DSIZEOF_LONG=8 -DHAVE_NETINET_SCTP_H=1 -DHAVE_NETDB_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_GETHOSTBYNAME_R=1) # -DDEBUG=/\*\*/)
ENDIF(NOT DEFINED WIN32)

# includes
SET(mod_freetdm_INCLUDES
	${PROJECT_SOURCE_DIR}/../src/include 
	${PROJECT_SOURCE_DIR}/../src/isdn/include 
	${PROJECT_SOURCE_DIR}/../../libteletone/src
	${PROJECT_SOURCE_DIR}/../../../src/include
)
INCLUDE_DIRECTORIES(${mod_freetdm_INCLUDES})

LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/..)
ADD_LIBRARY(${PROJECT_NAME} SHARED mod_freetdm.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} freetdm -fPIC -Werror -fvisibility=hidden)

IF(DEFINED WIN32)
	SET(EXT lib)
ELSE(DEFINED WIN32)
	SET(EXT so)
ENDIF(DEFINED WIN32)

ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
	COMMAND ${CMAKE_COMMAND} -E rename lib${PROJECT_NAME}.${EXT} ${PROJECT_NAME}.${EXT}
)
